/*
 * @描述:  可编辑table单元
 * @Author: /songzi
 * @Date: 2019-12-27 17:56:59
 * @Last Modified by: songzi
 * @Last Modified time: 2019-12-28 10:46:33
 */

import React, { PureComponent, Fragment } from 'react';
import { InputNumber, Input, Form } from 'antd';
import MapInput from '../FormTools/MapInput';

class EditAbleCell extends PureComponent {
  renderCell = contentProp => {
    const getFieldDecorator = contentProp ? contentProp.getFieldDecorator : false;
    const { editing, dataIndex, title, inputType, record, index, children, inputconfig, ...restProps } = this.props;
    return <td {...restProps}>{editing ? <MapInput getFieldDecorator={getFieldDecorator} inputConfig={inputconfig}></MapInput> : children}</td>;
  };

  render() {
    const { contextnode } = this.props;
    const Cell = contextnode ? <contextnode.Consumer>{this.renderCell}</contextnode.Consumer> : this.renderCell();
    return Cell;
  }
}

export default EditAbleCell;
